Skip to main content

Enable Java Engine Logging

Java Report Engine uses log4j for its logging. Log4j must be configured both for the cases where the embedding application using Java Report Engine also uses log4j, and for the case where Java Engine is the only component using log4j. (Note that WindwardReportsServer.jar must use the log4j configuration file.)

Java Report Engine can't just turn off logging because that would cause problems for embedding application components using log4j. There is no way for Java Report Engine to know if log4j is being used elsewhere.

Your three options are:

  1. If you use log4j and you initialize it before calling Java Report Engine, then delete the logging.filename=... entry in WindwardReports.properties. In this case Java Report Engine assumes log4j is already initialized.

  2. If you use log4j but do not initialize it before first calling Java Report Engine, then set the logging.filename=... entry in WindwardReports.properties to point to your log4j.properties file. This entry is first tried as a URL and if that fails, then as a filename. (Note that a filename is not a legitimate URL.)

For more information on log4j configuration, please refer to the log4j documentation. The filename you set for log4j is passed to log4j using the call (logFile is the string from the property logging.filename):

PropertyConfigurator.configure( new URL( logFile ));

And if that fails, then:

PropertyConfigurator.configure( logFile );
  1. To turn logging off (this is not recommended), set the entry to:
logging.filename=off

If you do not use log4j elsewhere, then set logging.filename=log4j.properties (fully specify the file location) and create a log4j.properties file.

For standard logging, we suggest these properties:

log4j.rootLogger=INFO, file
log4j.appender.file=org.apache.log4j.RollingFileAppender
# Write log messages to this file
log4j.appender.file.File=C:/temp/JavaEngine.log
# when file reaches this size, will start a new file
log4j.appender.file.MaxFileSize=10MB
#when starting a new file, previous file will be JavaEngine.log.1, up to JavaEngine.log.10
log4j.appender.file.MaxBackupIndex=10
log4j.appender.file.layout=org.apache.log4j.PatternLayout
# This is the information logged
log4j.appender.file.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%x - %m%n

For debug logging (when requested by Support), use these properties:

log4j.rootLogger=DEBUG, file
log4j.appender.file=org.apache.log4j.FileAppender
# Write log messages to this file
log4j.appender.file.File=C:/temp/JavaEngine.log
log4j.appender.file.layout=org.apache.log4j.PatternLayout
# This is the information logged
log4j.appender.file.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%x - %m%n

Log4j Settings to Log All Engine Components

Java Report Engine makes use of several 3rd-party libraries. To turn on logging for all components you must set log4j to enable logging for all of the following classes:

log4j.logger.net.windward=DEBUG
log4j.logger.com.lowagie=DEBUG
log4j.logger.org.apache.commons.codec=DEBUG
log4j.logger.org.apache.poi=DEBUG
log4j.logger.org.apache.xerces.impl.xpath=DEBUG
log4j.logger.org.bouncycastle=DEBUG
log4j.logger.org.dom4j=DEBUG
log4j.logger.org.jaxen=DEBUG
log4j.logger.org.relaxng=DEBUG
# versions 611 only:
log4j.logger.org.jfree=DEBUG
tip

If logging is slowing you down, please see this article from Apache to remove or disable unneeded loggers, appenders or layouts.